import { defineStore } from 'pinia'
import { getRouters } from '@/api/userInfo'
import{RouteItem} from '@/interface/userRouters'
export const useMenuStore = defineStore('menuId', {
  state: ():{
    menu:RouteItem[]
  } => {
    return {
        menu:[],
    }
  },
  getters:{},
  actions:{
    async getMenu(){
        let res = await getRouters();
        this.menu = res.data;
    }
  },
  persist: {
    enabled: true, //开启数据缓存
    strategies: [
      {
        storage: localStorage,//默认走session
        paths: ['menu']
      }
    ]
  }
})
